package com.myway.core.common;
import java.util.HashMap;

/**
 * @author 陈志钢(zhg_ch)
 * 
 * @description
 * 
 * AgentTypeEnum 代理人类型

 * 
 * @date 2008-10-30
 */
public enum AgentTypeEnum {

	AGENT("代理人"), TRAVEL("旅行社"), CORP("机构客户"),BAOJI("包机人");
	
	/**
	 * 别名
	 */
	private final String alias;
	private static HashMap<String, AgentTypeEnum> map = new HashMap<String, AgentTypeEnum>();
	
	static {
		for (AgentTypeEnum e : AgentTypeEnum.values()) {
			map.put(e.alias, e );
		}
	}
	
	AgentTypeEnum(String alias) {
		this.alias = alias;
	}
	
	@Override
	public String toString() {
		return this.alias;

	}
	
	/**
	 * Return a <code>AgentTypeEnum</code> object holding the value of specified alias name
	 * @param alias the alias name of the type
	 * @return a <code>AgentTypeEnum</code> object holding the value represented by the alias name argument
	 */
	public static AgentTypeEnum valueOfAlias(String alias) {
		AgentTypeEnum type = map.get(alias);

		if (type == null) {
			throw new IllegalArgumentException("Unknown Agent type enum alias [" + alias + "]");
		}

		return type;
	}	
}
